<?php
    class sscls_NewsModel extends sscls_Model
    {   

        function __construct()
        {
            parent::__construct();
        }
		function getArticles($catid)
		{
			$query="select * from article where catid=".(int)$catid." and published=1";
			return $this->_getList($query,5,$this->getTotal($catid),$catid);
		}
		function getLink($date,$catid)
		{ 
			$query="select * from article where catid=".(int)$catid." and published=1 and datecreated<".$date." limit 0,5";
			return $this->_db->loadObjectList($query);
			
		}
		function getTotal($catid)
		{
			$query="select count(id) from article where catid=".(int)$catid." and published=1";
			return $this->_db->loadResult($query);
		}
		function getItem($articleid)
		{
			$query="select * from article where id=".(int)$articleid.' and published=1';
			return $this->_db->loadObject($query);
		}
		function getCategories($catid)
		{
			$query="select * from categories where id=".$catid;
			return $this->_db->loadObject($query);
		}
		
	   function getID()
		{
			return $this->_db->insert_id();
		}
	   
	  
    }
?>
